<html>
<!-- =====================================================================

  File:      DefaultPage.htm for Adventure Works Cycles Storefront Sample
  Summary:   Self-documentation for application
  Date:	     June 16, 2003

=====================================================================

  This file is part of the Microsoft SQL Server Code Samples.
  Copyright (C) Microsoft Corporation.  All rights reserved.

This source code is intended only as a supplement to Microsoft
Development Tools and/or on-line documentation.  See these other
materials for detailed information regarding Microsoft code samples.

THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

======================================================= -->
    <head>
        <title>Adventure Works Cycles Store Documentation</title>
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <h1>
        Default.aspx Page
        </h1>
        <p>
            <b>Note:</b>&nbsp;Click the links above to view details and source code about the 
        components, user controls, and stored procedures used to create this page.
        </p>
        <p>
            <b>Description and Features:</b>&nbsp;The Default.aspx page is the home page for the Adventure Works Cycles application. It 
        welcomes users to the application and provides a short overview. To entice 
        users into entering deeper into the site, the default page displays a weekly 
        "most popular items" list and a single featured item displayed with a graphic.
        </p>
        <p>
            <b>Implementation Details:</b>&nbsp;The default page is largely static - much of the work is done by other 
        components. For example, the header, menu, and "popular items" list are all 
        implemented in separate user controls referenced from this page.
        </p>
        <p>
        The default page itself includes just a few lines of code to check whether the 
        user has logged in.&nbsp; If so, the page displays a friendly personalized 
        welcome message.&nbsp; The personalization is done in the Page_Load 
        event-handling method. This event is raised on the server every time the page 
        is accessed by a browser. It provides a convenient way to structure server 
        logic that needs to run at the beginning of every page access. The code looks 
        like this:
        </p>
        <pre>
        
        void Page_Load(Object sender, EventArgs e) { 
        
            // Customize welcome message if personalization cookie is present 
            if (Request.Cookies["AdventureWorks_FullName"] != null) {
                WelcomeMsg.Text = "Welcome " + Request.Cookies["AdventureWorks_FullName"].Value;
            } 
        
        }
        </pre>
        <p>
        In the method, the welcome message is generated by retrieving a client-side 
        cookie (persisted on the client in the Login.aspx and Register.aspx pages). If 
        the cookie is found, the user name is extracted from it and displayed using a 
        server-side label control. For details about how the cookie is generated, 
        review the Login.aspx page.
        </p>
        <p>
            <b>Performance Notes</b></p>
        <ul>
            <li>
            Because this page serves as the start page into the Adventure Works Cycles application - the 
            page most heavily accessed - it has been specifically designed for top 
            performance. We chose not to cache the entire page (unlike the ProductDetails 
            and ProductsList pages) for output, because we want to be able to personalize 
            the user's browsing experience.
            <li>
            For performance, we designed the page to avoid database calls for each request. 
            Instead, we stored personalization information (in this case the user name) in 
            an optional&nbsp;client-side cookie.
            <li>
            In contrast, the Menu and PopularItems user controls <em>do</em>
            use information pulled from a database. However, these user controls leverage 
            partial page output caching to cache the database
            results and only update their data once per hour. 
            </li>
        </ul>
    </body>
</html>

